package com.llg.controller;

import com.llg.model.response.DataResult;
import com.llg.model.response.PageResult;
import com.llg.model.response.ResponseResult;
import com.llg.pojo.ReceiveBrand;
import com.llg.service.ReceiveBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ReceiveBrand")
public class ReceiveBrandController {

    @Autowired
    private ReceiveBrandService service;

    //查找全部接收卡品牌
    @GetMapping("/findAll")
    public PageResult<ReceiveBrand> findAll() {
        return service.findAll();
    }

    //搜索并分页查询
    @PostMapping("/findList")
    public PageResult<ReceiveBrand> findList(Integer currentPage,Integer pageSize,@RequestBody ReceiveBrand receiveBrand){
        return service.findList(currentPage, pageSize, receiveBrand);
    }

    //通过id查找
    @GetMapping("/{id}")
    public DataResult<ReceiveBrand> findById(@PathVariable("id") Integer id){
        return service.findById(id);
    }

    //增
    @PostMapping("/add")
    public DataResult<ReceiveBrand> add(@RequestBody ReceiveBrand receiveBrand){
        return service.add(receiveBrand);
    }

    //删
    @GetMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return service.delete(id);
    }

    //改
    @PostMapping("/update")
    public ResponseResult update(@RequestBody ReceiveBrand receiveBrand){
        return service.update(receiveBrand);
    }
}
